<?php
/**
 * Created by PhpStorm.
 * User: iwm
 * Date: 2017/1/6
 * Time: 15:43
 */

namespace app\home\controller;

use app\library\Common;
use app\library\CommonConfig;
use think\Cookie;
use think\Request;
use think\Controller;
use app\home\model\page\Login as LoginModel;

class Login extends Controller
{
    private $param;

    public function __construct()
    {
        parent::__construct();

        $this->param = Request::instance()->param();
    }

    public function loginPage()
    {
        Cookie::set(CommonConfig::COOKIE_TYPE, Common::getToken(), ['expire' => CommonConfig::COOKIE_EXPIRE_TIME,]);
        return $this->fetch("home/pages/login");
    }

    public function login()
    {
        $objLogin = new LoginModel();
        $result = $objLogin->excute($this->param);
        return json($result);
    }

    public function test()
    {
        return ($this->fetch('home/pages/notedetail'));
        //return ($this->fetch('home/oss/index'));
    }
}

